package com.lian.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lian.pojo.PageBean;
import com.lian.pojo.Policy;
import com.lian.mapper.PolicyMapper;
import com.lian.service.PolicyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lsx
 * @since 2024-04-30
 */
@Service
public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy> implements PolicyService {
    @Autowired
    PolicyMapper policyMapper;
    @Override
    public PageBean selectAll(Integer page,Integer pageSize,String name, String document, String organ, String text,String type) {
        PageHelper.startPage(page,pageSize);
       List<Policy>list= policyMapper.selectAll(name,document,organ,text,type);
        Page<Policy> p= (Page<Policy>) list;
        PageBean pageBean=new PageBean(p.getTotal(),p.getResult());
        return pageBean;
    }

    @Override
    public String getText(Long id) {
        String todayText=policyMapper.getText(id);
        return todayText;
    }


}
